package com.example.demo.DAO;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.demo.entity.Dish;
import lombok.Data;

import java.util.List;

@Data
public class PageResult<T> {
    private Integer code;
    private String msg;
    private List<T> data;
    private Long total;

    public static <T> PageResult<T> success(Page<T> page) {
        PageResult<T> result = new PageResult<>();
        result.code = 200;
        result.msg = "success";
        result.data = page.getRecords();
        result.total = page.getTotal();
        return result;
    }

    public static PageResult<Dish> error(String restaurantId不能为空) {
        return null;
    }
}
